<?php
include_once("./function.php");
$sql="select * from ts_product_cate";
$res=mysqli_query($link,$sql);
if(is_object($res))
{
	if(mysqli_num_rows($res)>0)
	{
		$sys=array();
		while(($list=mysqli_fetch_assoc($res))!=false)
		{
			$sys[]=$list;
		}
		//print_r($sys);
	}
}
//无线分类
function card($arr,$pc_fid)
{
	static $new=array();
	foreach($arr as $v)
	{
		if($v['pc_fid']==$pc_fid)
		{
			$new[]=$v;
			card($arr,$v['pc_id']);
		}
	}
	return $new;
}
$sys=card($sys,0);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主体部分</title>
<base target="_self">
<link rel="stylesheet" type="text/css" href="skin/css/base.css" />
<link rel="stylesheet" type="text/css" href="skin/css/main.css" />
</head>
<body leftmargin="8" topmargin='8'>
<?php include_once("./function.php");?>
<table width="98%" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px;margin-top:8px;">
  <tr>
    <td background="./skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' border="0px"><span><img src='./skin/images/frame/arr3.gif' style='margin-right:10px;'>商品分类管理</span></td>
	<td align="right" background="./skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' border="0px"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td colspan="2">
		<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CFCFCF" align="center" style="margin-top:8px">
		
			<tr align="center" bgcolor="#FBFCE2" height="25">
				<td width="6%">ID</td>
				<td>分类名</td>
				<td width="4%">分类等级</td>
				<td width="28%">是否显示</td>
				<td>操作</td>
			</tr>
  <!-- data start-->
		<?php 
			if(isset($sys)){foreach($sys as $v){
		?>
			<tr align='center' bgcolor="#FFFFFF" height="26" align="center" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
				<td nowrap><?=$v['pc_id']?></td>
				<td align='left'><?=str_repeat("&nbsp;",10*($v['pc_level']-1)).$v['pc_name']?></td>
				<td width="25%"><?=$v['pc_level']?></td>
				<td width="20%">
					<a href="do_cate_show.php?pc_ifshow=<?=$v['pc_ifshow']?>&pc_id=<?=$v['pc_id']?>">
					<font color="blue">
					<?php if($v['pc_ifshow']=="show"){?>
					<?php echo "显示";}elseif($v['pc_ifshow']=="noshow"){?>
					<?php echo "<b>不显示</b>";}?>
					</font>
					</a>
				</td>
				<td>
					<a href="./product_cate_add.php">
					<img src='./skin/images/frame/part-list.gif' title="添加" alt="添加" onClick="viewArc(179);" style='cursor:pointer' border='0' width='16' height='16' />
					</a>
					<a href="./product_cate_edit.php?id=<?=$v['pc_id']?>"><img src='./skin/images/frame/trun.gif' title="修改" alt="修改" border='0' width='16' height='16' onClick="QuickEdit(179, event, this);" style='cursor:pointer'/></a>
					<a href="./do_product_cate_del.php?pc_id=<?=$v['pc_id']?>">
					<img src='./skin/images/frame/gtk-del.png' title="删除" alt="删除" onClick="editArc(179);" style='cursor:pointer' border='0' width='16' height='16' />
					</a>	
				</td>
			</tr>
			<?php }}?>
				</table>
			</td>
		  </tr>
  <!-- data end-->
 
  <!-- page start-->
	  <tr align="right" bgcolor="#F9FCEF">
		<td height="36" colspan="10" align="center">
			<div class="pagelistbox">
				<span class='indexPage'>首页 
				 
				</span><strong>1</strong>
				
				<a class='endPage' href='#'>末页</a> 
				</div>
			</td>
	  </tr>
  <!-- page end-->
</table>
</body>
</html>
